/**
Copyright 2015 The Cockroach Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License.

Author: Matt Tracy (matt@cockroachlabs.com)
*/

$font-base-size = 14px
$font-line-height = $font-base-size * 1.5
$root-size = $font-line-height / 2

// A really simple implementation of a Modular Scale.
// For an example, see http://www.modularscale.com/
$font-ratio = 1.2
$font-size-table = {
  '5': $font-base-size * ($font-ratio**5),
  '4': $font-base-size * ($font-ratio**4),
  '3': $font-base-size * ($font-ratio**3),
  '2': $font-base-size * ($font-ratio**2),
  '1': $font-base-size * ($font-ratio),
  '0': $font-base-size,
  '-1': $font-base-size * (1 / $font-ratio),
  '-2': $font-base-size * (1 / $font-ratio**2),
  '-3': $font-base-size * (1 / $font-ratio**3),
}

// Select a modular font size from the table.
modular-font-size($font-size)
  font-size: remove-unit($font-size-table[$font-size]/$root-size) rem

// Using the same strategy as sassline: establish the root size (rems) as 1/2
// of our chosen baseline height. This allows easy, integer math for baseline units
// using rems.
html
  font-size $root-size

body
  line-height 2rem
  font-size $font-base-size
  font-family Lato-Medium
  font-weight 400

h1
  modular-font-size '3'
  line-height 4rem
  font-weight 600

h2
  modular-font-size '3'
  line-height 4rem
  font-weight 500

h3
  modular-font-size '1'
  line-height 2rem
  font-weight 600

@require '../modules/fonts.styl'

font-face('Lato-Bold')
font-face('Lato-Medium')
font-face('Lato-Light')
font-face('Lato-BoldItalic', 'italic')
font-face('Lato-MediumItalic', 'italic')
font-face('Lato-LightItalic', 'italic')
